X-Git-Url: https://permondes.de/gitweb/Analog_Engine.git/blobdiff_plain/7fbf87e4750e1393d9b6395818b70000ca99c758..6e4089e8217c971c0154c414f5fed5d0807d179e:/scripts/TP1%2004.12%20Harmonic%20Oscillator.AESL diff --git a/scripts/TP1 04.12 Harmonic Oscillator.AESL b/scripts/TP1 04.12 Harmonic Oscillator.AESL new file mode 100644 index 0000000..2c0e512 --- /dev/null +++ b/scripts/TP1 04.12 Harmonic Oscillator.AESL @@ -0,0 +1,40 @@ +IDENTIFICATION DIVISION +PROGRAM-ID HarmonicOscillator +VERSION 20240201 +COMMENT A mass m is subject to a force F=-k*r. +COMMENT What is the trajectory if the mass starts at position (a,0,0)? +COMMENT How much time does it take to pass through zero? +COMMENT What is the trajectory if it starts at (a,0,0) with velocity (0,v0,0)? +COMMENT m*x'' = -k*x +COMMENT m*y'' = -k*y (z can be set to 0). + +ENVIRONMENT DIVISION +ENGINE Anabrid-THAT +TIMEBASE 1ms +REQUIRES COEFFICIENT 4, INTEGRATOR 4, INVERTER 2 + +DATA DIVISION +OUTPUT OUTPUT.X x +OUTPUT OUTPUT.Y y +COEFFICIENT.1 A # (a,0,0) +COEFFICIENT.2 K/M_x # k/m for x +COEFFICIENT.3 V0 # (0,v0,0) +COEFFICIENT.4 K/M_y # k/m for y, identical to k/m for x + +PROGRAM DIVISION +-1 -> COEFFICIENT.A -> -a # has to be negative because x' is negative ++1 -> COEFFICIENT.V0 -> v0 # has to be positive because y'' is positive + +x'' -> INTEGRATOR -> -x' +-x', IC:-a -> INTEGRATOR -> x +x -> COEFFICIENT.K/M_x -> k/m*x +k/m*x -> INVERTER -> -k/m*x = x'' + +y'', IC:v0 -> INTEGRATOR -> -y' +-y' -> INTEGRATOR -> y +y -> COEFFICIENT.K/M_y -> k/m*y +k/m*y -> INVERTER -> -k/m*y = y'' + +OPERATION DIVISION +MODE REPEAT +OP-TIME 100 ms